/*  This file is part of -_-.

    -_- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    -_- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with -_-.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2012-2013 Oliver Katz */

#ifndef __ARCH_C_COMPAT_H
#define __ARCH_C_COMPAT_H

#include "arch.h"

extern sleepyface::arch::Architecture *_arch;
#define Z_SET_ARCHITECTURE(a) _arch = (sleepyface::arch::Architecture *)a
#define Z_GET_ARCHITECTURE() _arch

extern "C"
{
    int z_value_get_type(sleepyface::arch::ModuleValue *v); //method: gets the type from a value reference
    int z_value_get_bool(sleepyface::arch::ModuleValue *v); //method: gets the boolean value from a value reference
    int z_value_get_int(sleepyface::arch::ModuleValue *v); //method: gets the integral value from a value reference
    char *z_value_get_string(sleepyface::arch::ModuleValue *v); //method: gets the string value from a value reference
    void *z_value_get_data(sleepyface::arch::ModuleValue *v); //method: gets the data value from a value reference
    sleepyface::arch::ModuleValue *z_value_new_int(int v); //method: creates a new value reference from an integer
    sleepyface::arch::ModuleValue *z_value_new_string(char *v); //method: creates a new value reference from a string
    sleepyface::arch::ModuleValue *z_value_new_data(void *v); //method: creates a new value reference from a pointer
    int z_arch_signal0(char *m, int s); //method: signal an architectural module with no arguments
    int z_arch_signal1(char *m, int s, sleepyface::arch::ModuleValue *a0); //method: signal an architectural module with 1 argument
    int z_arch_signal2(char *m, int s, sleepyface::arch::ModuleValue *a0, sleepyface::arch::ModuleValue *a1); //method: signal an architectural module with 2 arguments
    sleepyface::arch::ModuleValue *z_arch_get(char *m, char *k0, char *k1); //method: gets a value reference from an architectural module
    sleepyface::arch::ModuleValue *z_arch_set(char *m, char *k0, char *k1, sleepyface::arch::ModuleValue *v); //method: sets a value in an architectural module
    char **z_arch_keylist(char *m); //method: lists the keys in an architectural module
    int z_arch_is_loaded(char *m); //method: checks to see if a module is loaded in the architecture
    char **z_arch_list(); //method: lists all the loaded modules in the architecture
    int z_arch_get_memory_usage(); //method: returns the memory usage in bytes of the process
}

#endif